home *** CD-ROM | disk | FTP | other *** search
/ Merciful 1 / Merciful - Disc 1.iso / software / t / thinker_ii / thinkerii.dms / in.adf / bword.thnkr < prev    next >
Encoding:
Text File  |  1989-12-05  |  892 b   |  34 lines

  1. /****************************************************************/
  2. /*  move the cursor to the beginnning of the previous word      */
  3. /*  Rexx errors are reported as RC= in the error message box    */
  4. /*  The return results of this program are reported on the      */
  5. /*  clipboard.                                                  */
  6. /****************************************************************/
  7. trace off
  8. options results
  9. 'get cursor'
  10. statement=result
  11. if rc = 0 then do
  12.    'cursor fetch'
  13.    i=result 
  14. /* 
  15.    The cursor counts from 0 to N-1. 
  16.    Rexx substrings count from 1 to N.
  17. */
  18.    do while i > 0
  19.       if substr(statement,i+1,1) ~= ' ' then leave  
  20.       i=i-1
  21.    end
  22.    do while i > 1
  23.       i=i-1
  24.       if substr(statement,i,1) ~= ' ' then do
  25.           i=lastpos(' ',statement,i)
  26.           'cursor set' i
  27.           exit 0
  28.       end
  29.    end
  30.    'cursor set 0'
  31.    exit 0
  32. end
  33. return 3
  34.